{extend name="template/base" /}
{block name="content"}
<div class="page-container">
<style>.btn{margin-top:3px; border:none;}</style>
	<input type="hidden" id="cat_id" name="id" value="{$Request.param.cat_id ?? ''}">
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
		{tp:menu menu="add" /}
		{tp:menu menu="forbid,delete" /}
		{tp:menu menu='saveOrder' /}
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count ?? '0'}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
            <th width="150">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            {include file="td" /}
            <td class="f-14">
                {$vo.status|show_status=$vo.id}
                {tp:menu menu='sedit' /}
                {tp:menu menu='sdelete' /}
				{if condition="$vo.isdefault eq 0"}
					<a href="javascript:;" id="d_{$vo.id}" onclick="main({$vo.id},1)">设为默认</a>
				{else /}
					<a href="javascript:;" style="color:red;" id="d_{$vo.id}" onclick="main({$vo.id},0)">取消默认</a>
				{/if}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
{/block}
{block name="script"}
<script>
    $(function () {
    });
	function main(id,m){
			$.ajax({
				data:{'id':id,'default':m},
				type: "post",
				url: "{:Url('Brand/change_default')}",
				dataType:'json', 
				beforeSend: function(XMLHttpRequest){
				},
				success: function(data, textStatus){
					location.reload();
				}
			});
	}
</script>
{/block}

